﻿using System.Linq;
using System.Xml.Serialization;
using ElectronicCommerce.Framework.Configuration.Attributes;

namespace ElectronicCommerce.Framework.Web.Configuration.Resource
{
    [ConfigFile("Seo.config")]
    [XmlRoot("pages")]
    public class SeoConfiguration
    {
        [XmlElement("page")]
        public SeoCollection SeoCollection { get; set; }

        public Seo GetSeo(string name)
        {
            Seo seo = SeoCollection.Where(c => c.Name.ToLower() == name.ToLower()).SingleOrDefault();
            if (seo != null)
            {
                return seo;
            }
            return new Seo();
        }

    }
}
